#!/usr/bin/env python2

from benchmarker import *
import time

@className('benchmark.Falsesharing')
#@className('benchmark.RandomwalkArray')
@appParams({'tnum':2, 'itimes':100000, 'stride':1, 'wcycles':100000, 'wtimes':5, 'bcycles':100000})
class falseSharing(benchmarker):
	def run(self):
		super(falseSharing, self).run()

def test():
	b = falseSharing()
	b.run()
	

def benchmarkFS():
	b = falseSharing()
	f = open('out.csv', 'a+')
	print('cycles,array size,result', file=f, flush=True)
	b.appParams['bcycles'] = 50000

	kb = 128
	mb = 1024 * kb

	for stride in range(1, 20):
		b.appParams['stride'] = stride
		b.run()
		result = str(b.appParams['bcycles']) + ',' + str(stride) + ',' + str(b.getResult())
		print(result, file=f, flush=True)
		time.sleep(1)

def main():
#	benchmarkFS()
	test()


if __name__ == '__main__':
	main()

